package ClassWork5;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Company company = new Company();

        TechDept techDept = new TechDept("Tech Department");
        HRDept hrDept = new HRDept("HR Department");
        FinanceDept financeDept = new FinanceDept("Finance Department");

        company.addDept(techDept);
        company.addDept(hrDept);
        company.addDept(financeDept);

        FullTimeEmployee fullTimeEmployee = new FullTimeEmployee("John Doe", 1, 5000.0, 1000.0);
        PartTimeEmployee partTimeEmployee = new PartTimeEmployee("Jane Smith", 2, 15.0, 10.0);

        company.addEmployee(fullTimeEmployee);
        company.addEmployee(partTimeEmployee);

        techDept.addEmployee(fullTimeEmployee);
        hrDept.addEmployee(partTimeEmployee);

        Scanner scanner = new Scanner(System.in);
        boolean isRunning = true;
        while (isRunning) {
            System.out.println("欢迎使用公司管理系统");
            System.out.println("1. 输出公司员工名单");
            System.out.println("2. 输出公司员工工资条");
            System.out.println("3. 财务部门为员工减薪");
            System.out.println("4. 财务部门为员工加薪");
            System.out.println("5. HR部门招聘新员工");
            System.out.println("6. HR部门开除员工");
            System.out.println("0. 退出系统");
            System.out.print("请输入操作选项: ");
            int choice = scanner.nextInt();
            switch (choice) {
                case 1:
                    company.printEmployeeList();
                    break;
                case 2:
                    company.printPayroll();
                    break;
                case 3:
                    financeDept.cutSalary(fullTimeEmployee, 300);
                    break;
                case 4:
                    financeDept.raiseSalary(fullTimeEmployee, 500);
                    break;
                case 5:
                    FullTimeEmployee newEmployee = new FullTimeEmployee("Alice", 3, 6000.0, 1500.0);
                    hrDept.recruitEmployee(newEmployee, techDept, company);
                    break;
                case 6:
                    hrDept.fireEmployee(fullTimeEmployee, company);
                    break;
                case 0:
                    isRunning = false;
                    System.out.println("已退出系统");
                    break;
                default:
                    System.out.println("无效的选项，请重新输入");
            }
        }
        scanner.close();
    }
}
